London|26-ITP-January|Alexandru Pocovnicu|Sprint 1|Coursework#908
London|26-ITP-January|Alexandru Pocovnicu|Sprint 1|Coursework#908alexandru-pocovnicu wants to merge 15 commits intoCodeYourFuture:mainfrom
Conversation
…ariable naming rules
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
3 similar comments
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
| let count = 0; | ||
|
|
||
| count = count + 1; | ||
| count = count + 1; //it assigns the variable "count" the value of "count +1" which 1 |
There was a problem hiding this comment.
Operation like count = count + 1 is very common in programming, and there is a programming term describing such operation.
Can you find out what one-word programming term describes the operation on line 3?
|
|
||
|
|
||
| console.log(`The base part of ${filePath} is ${base}`); | ||
|
|
||
| // Create a variable to store the dir part of the filePath variable | ||
| // Create a variable to store the ext part of the variable | ||
|
|
||
| const dir = ; | ||
| const ext = ; | ||
| const dir = filePath.slice(0,lastSlashIndex); | ||
| const ext = filePath.slice(lastDotIndex+1); | ||
|
|
There was a problem hiding this comment.
Have you tested the code to see if it can produce the result you expected?
| const cardNumber = 4533787178994213; | ||
| const cardNumber = "4533787178994213"; | ||
| const last4Digits = cardNumber.slice(-4); |
There was a problem hiding this comment.
Suppose you were not allowed to modify the statement const cardNumber = 4533787178994213;
(that is, keep the variable's value unchanged).
How would you modify the code (through type conversion) so that you can still use .slice(-4) to extract the last 4 digits from the given number.
| //5. const pence = paddedPenceNumberString | ||
| // .substring(paddedPenceNumberString.length - 2) | ||
| // .padEnd(2, "0") | ||
| //it extracts the last two characters (pence) from paddedPenceNumberString and it makes sure that there's always gonna be two by adding "0" at the end |
There was a problem hiding this comment.
Could we expect this program to work as intended for any valid penceString if we deleted .padEnd(2, "0") from the code?
In other words, do we really need .padEnd(2, "0") in this script?
Learners, PR Template
Self checklist
Changelist
Implemented functions,debbuged errors using MDN an interpreted code